<template>
  <div id="Deductible">
    <div class="bg"></div>
    <div class="sarch">
      <van-search placeholder="搜索喜欢的商品" v-model="value" @search="onSearch" />
    </div>
    <van-tabs v-model="active">
      <van-tab title="综合"></van-tab>
      <van-tab title="新品"></van-tab>
      <van-tab title="推荐"></van-tab>
      <van-tab title="精品"></van-tab>
    </van-tabs>
    <van-swipe :autoplay="3000">
      <van-swipe-item><img src="../../static/img/banner@3x.png"/></van-swipe-item>
      <van-swipe-item><img src="../../static/img/banner@3x.png"/></van-swipe-item>
      <van-swipe-item><img src="../../static/img/banner@3x.png"/></van-swipe-item>
      <van-swipe-item><img src="../../static/img/banner@3x.png"/></van-swipe-item>
    </van-swipe>
    <van-notice-bar
      text="足协杯战线连续第2年上演广州德比战，上赛季半决赛上恒大以两回合5-3的总比分淘汰富力。"
      left-icon="../../static/img/icon_gg@3x.png"
    />
    <van-list v-model="loading" :finished="finished" @load="onLoad">
      <div class="count">
        <div>
          <div style="width:100%;background: #eeeeee;float:left;">
            <div   v-for="item in list" :key="item"  class="details">
              <div>
                <img src="../../static/img/img_3@3x.png" :lazy="'.static/img/cs.png'" :loading="'.static/img/cs.png'"/>
              </div>
              <div>
                <span>男士秋季韩版牛仔外套休闲夹克春秋学生修身潮流</span>
                <div>
                  <span>￥54.5</span>
                  <span>销量1250</span>
                  <span>抵扣100</span>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </van-list>
  </div>
</template>

<script>
  export default {
    name: "Deductible",
    data() {
      return {
        active: 0,
        list: [],
        loading: false,
        finished: false
      };
    },
    methods: {
      onSearch() {
        var $this=this;
        alert($this.value)
      },
      onLoad() {
        // 异步更新数据
        setTimeout(() => {
          for (let i = 0; i < 5; i++) {
            this.list.push(this.list.length + 1);
          }
          // 加载状态结束
          this.loading = false;

          // 数据全部加载完成
          if (this.list.length >= 40) {
            this.finished = true;
          }
        }, 500);
      }
    }
  }
</script>

<style scoped>
  .count{
    width: 100%;
    float: left;
    margin-bottom:60px;
  }
  .count>div{
    width: 100%;
    background: #ffffff;
    padding-top:10px;
    float: left;
  }
  .count>div>p{
    text-align:left;
    margin: 0;
    margin-left: 2%;
    margin-bottom:10px;
    padding-left: 10px;
    border-left: 3px solid #fe513f;
    color: #fe513f;
  }
  .details{
    background: #eeeeee;
    width:49%;
    float: left;
    margin-left:0.5%;
    margin-top:6px;
  }
  .details>div{
    width:100%;
    display: inline-block;
  }
  .details>div>img{
    display: block;
    width: 100%;
    border-top-left-radius:10px;
    border-top-right-radius:10px;
  }
  .details>div:last-child{
    background: #ffffff;
    position: relative;
    top: -5px;
    text-align: left;
    border-bottom-left-radius:10px;
    border-bottom-right-radius:10px;
    padding-bottom:5px;
  }
  .details>div:last-child>span{
    display: block;
    width: 95%;
    margin: 0 auto;
    font-size: 16px;
  }
  .details>div:last-child>div{
    margin-top: 15px;
  }
  .details>div:last-child>div>span:first-child{
    font-size: 22px;
    color: #fe513f;
  }
  .details>div:last-child>div>span:nth-child(2){
    font-size:14px;
    color: #959595;
    margin-left: 3px;
  }
  .details>div:last-child>div>span:last-child{
    font-size:14px;
    color: #fe513f;
    display: inline-block;
    padding: 1px 3px;
    border: 1px solid #fe513f;
    border-radius:10px;
    position: relative;
    right:4px;
    top: 3px;
    float: right;
  }
</style>
<style>
  body{
    background: #eeeeee;
  }
  #Deductible .van-search{
    padding: 15px!important;
    background: #fe513f!important;

  }
  #Deductible .van-search .van-cell{
    border-radius: 25px;
    background: #f7f7f7;
    padding:3px 10px;
  }
  #Deductible .van-swipe{
    width: 100%;
  }
  #Deductible .van-swipe-item>img{
    display: block;
    width: 100%;
    height: 100%;
  }
  .van-notice-bar{
    background: #ffffff;
    color: #fe513f;
  }
  .van-notice-bar__wrap{
    margin-left:10px;
  }
  .bg{
    position: absolute;
    width: 100%;
    height: 100%;
    background:#eeeeee;
    z-index: -2
  }
</style>
